
function [testdata] = openTestData(testroot)

    % Get all directories inside the root
    allFiles = dir(testroot);
    
    % Get only the names of the files and folders inside the folder
    allNames = cell({allFiles.name});
    
    % Filter only the folders
    testDirs = {};
    for i = 1:length(allNames)
        if ((allFiles(i).isdir == 1) && (~strcmp(allNames{i},'..') && ~strcmp(allNames{i},'.')))
            if (isempty(testDirs))
                testDirs = [{allNames{i}}];
            else
                testDirs = [testDirs {allNames{i}}];
            end
        end
    end
    
    % Get images on each folder
    testdata = cell(size(testDirs));
    for i = 1:length(testDirs)
        if (length(testDirs)==1)
            [testInfo.images, testInfo.labels, testInfo.masks, testInfo.numberOfPixels] = openLabeledData(strcat(testroot, filesep, testDirs{i}));
            testInfo.testName = testDirs(i);
            testdata{i} = testInfo;
        else
            [testInfo.images, testInfo.labels, testInfo.masks, testInfo.numberOfPixels] = openLabeledData(strcat(testroot, filesep, testDirs));
            testInfo.testName = testDirs;
            testdata{i} = testInfo;
        end
    end

end